home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / gimp-headers.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  7.2 KB  |  193 lines

  1. ; GIMP - The GNU Image Manipulation Program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; www.gimp.org web headers
  5. ; Copyright (c) 1997 Adrian Likins
  6. ; aklikins@eos.ncsu.edu
  7. ;
  8. ; based on a idea by jtl (Jens  Lautenbacher)
  9. ; and improved by jtl
  10. ;
  11. ; This program is free software: you can redistribute it and/or modify
  12. ; it under the terms of the GNU General Public License as published by
  13. ; the Free Software Foundation; either version 3 of the License, or
  14. ; (at your option) any later version.
  15. ;
  16. ; This program is distributed in the hope that it will be useful,
  17. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. ; GNU General Public License for more details.
  20. ;
  21. ; You should have received a copy of the GNU General Public License
  22. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  23. ;
  24. ;  **NOTE**  This fonts use some very common fonts, that are typically
  25. ;  bitmap fonts on most installations. If you want better quality versions
  26. ;  you need to grab the urw font package form www.gimp.org/fonts.html
  27. ;  and install as indicated. This will replace the some current bitmap fonts
  28. ;  with higher quality vector fonts. This is how the actual www.gimp.org
  29. ;  logos were created.
  30. ;
  31. ; ************************************************************************
  32. ; Changed on Feb 4, 1999 by Piet van Oostrum <piet@cs.uu.nl>
  33. ; For use with GIMP 1.1.
  34. ; All calls to gimp-text-* have been converted to use the *-fontname form.
  35. ; The corresponding parameters have been replaced by an SF-FONT parameter.
  36. ; ************************************************************************
  37.  
  38. (define (script-fu-headers-gimp-org text font font-size text-color high-color side-color shadow-color crop rm-bg index num-colors)
  39.   (let* (
  40.         (img (car (gimp-image-new 256 256 RGB)))
  41.         (text-layer (car (gimp-text-fontname img -1 0 0
  42.                                     text 30 TRUE font-size PIXELS
  43.                                     font)))
  44.         (width (car (gimp-drawable-width text-layer)))
  45.         (height (car (gimp-drawable-height text-layer)))
  46.         (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
  47.         )
  48.  
  49.     (gimp-context-push)
  50.  
  51.     (gimp-image-undo-disable img)
  52.     (gimp-image-resize img width height 0 0)
  53.     (gimp-image-add-layer img bg-layer 1)
  54.     (gimp-layer-set-lock-alpha text-layer TRUE)
  55.     (gimp-context-set-background text-color)
  56.     (gimp-edit-fill text-layer BACKGROUND-FILL)
  57.  
  58.     (gimp-context-set-background '(255 255 255))
  59.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  60.  
  61.     (let* (
  62.           (highlight-layer (car (gimp-layer-copy text-layer TRUE)))
  63.           (side-layer (car (gimp-layer-copy text-layer TRUE)))
  64.           (shadow-layer (car (gimp-layer-copy text-layer TRUE)))
  65.           )
  66.  
  67.       (gimp-image-add-layer img highlight-layer 1)
  68.       (gimp-layer-set-lock-alpha highlight-layer TRUE)
  69.  
  70.       (gimp-image-add-layer img side-layer 1)
  71.       (gimp-layer-set-lock-alpha side-layer TRUE)
  72.  
  73.       (gimp-image-add-layer img shadow-layer 1)
  74.       (gimp-layer-set-lock-alpha shadow-layer TRUE)
  75.  
  76.       (gimp-context-set-background high-color)
  77.       (gimp-edit-fill highlight-layer BACKGROUND-FILL)
  78.       (gimp-layer-translate highlight-layer -1 -1)
  79.  
  80.       (gimp-context-set-background side-color)
  81.       (gimp-edit-fill side-layer BACKGROUND-FILL)
  82.       (gimp-layer-translate side-layer 1 1)
  83.  
  84.       (gimp-context-set-background shadow-color)
  85.       (gimp-edit-fill shadow-layer BACKGROUND-FILL)
  86.       (gimp-layer-translate shadow-layer 5 5)
  87.  
  88.       (gimp-layer-set-lock-alpha shadow-layer FALSE)
  89.       (plug-in-gauss-rle RUN-NONINTERACTIVE img shadow-layer 5 TRUE TRUE)
  90.       (gimp-layer-set-opacity shadow-layer 60)
  91.       (gimp-image-lower-layer img shadow-layer)
  92.       (gimp-image-lower-layer img shadow-layer)
  93.     )
  94.  
  95.  
  96.     (set! text-layer (car (gimp-image-flatten img)))
  97.     (gimp-layer-add-alpha text-layer)
  98.  
  99.  
  100.     (if (= rm-bg TRUE)
  101.         (begin
  102.           (gimp-by-color-select text-layer '(255 255 255)
  103.                                 1 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
  104.           (gimp-edit-clear text-layer)
  105.           (gimp-selection-none img)
  106.         )
  107.     )
  108.  
  109.     (if (= crop TRUE)
  110.          (plug-in-autocrop RUN-NONINTERACTIVE img text-layer)
  111.     )
  112.  
  113.     (if (= index TRUE)
  114.         (gimp-image-convert-indexed img FS-DITHER MAKE-PALETTE num-colors
  115.                                     FALSE FALSE "")
  116.     )
  117.  
  118.  
  119.     (gimp-image-undo-enable img)
  120.     (gimp-display-new img)
  121.  
  122.     (gimp-context-pop)
  123.   )
  124. )
  125.  
  126.  
  127. (define (script-fu-big-header-gimp-org text font font-size text-color
  128.                                        high-color side-color shadow-color
  129.                                        crop rm-bg index num-colors)
  130.   (script-fu-headers-gimp-org (string-append " " text)
  131.                                font font-size
  132.                                text-color high-color side-color shadow-color
  133.                                crop rm-bg index num-colors)
  134. )
  135.  
  136.  
  137. (define (script-fu-small-header-gimp-org text font font-size text-color
  138.                                          high-color side-color shadow-color
  139.                                          crop rm-bg index num-colors)
  140.   (script-fu-headers-gimp-org text font
  141.                               font-size text-color high-color
  142.                               side-color shadow-color
  143.                               crop rm-bg index num-colors)
  144. )
  145.  
  146.  
  147. (script-fu-register "script-fu-big-header-gimp-org"
  148.   _"_Big Header..."
  149.   _"Create an image of a large header using the gimp.org webpage theme"
  150.   "Adrian Likins & Jens Lautenbacher"
  151.   "Adrian Likins & Jens Lautenbacher"
  152.   "1997"
  153.   ""
  154.   SF-STRING     _"Text"               "gimp.org"
  155.   SF-FONT       _"Font"               "Serif"
  156.   SF-ADJUSTMENT _"Font size (pixels)" '(50 2 1000 1 10 0 1)
  157.   SF-COLOR      _"Text color"         '(82 108 159)
  158.   SF-COLOR      _"Highlight color"    '(190 220 250)
  159.   SF-COLOR      _"Dark color"         '(46 74 92)
  160.   SF-COLOR      _"Shadow color"       "black"
  161.   SF-TOGGLE     _"Autocrop"           TRUE
  162.   SF-TOGGLE     _"Remove background"  TRUE
  163.   SF-TOGGLE     _"Index image"        TRUE
  164.   SF-ADJUSTMENT _"Number of colors"   '(15 2 255 1 10 0 1)
  165. )
  166.  
  167. (script-fu-menu-register "script-fu-big-header-gimp-org"
  168.                          "<Image>/File/Create/Web Page Themes/Classic.Gimp.Org")
  169.  
  170. (script-fu-register "script-fu-small-header-gimp-org"
  171.   _"_Small Header..."
  172.   _"Create an image of a small header using the gimp.org webpage theme"
  173.   "Adrian Likins & Jens Lautenbacher"
  174.   "Adrian Likins & Jens Lautenbacher"
  175.   "1997"
  176.   ""
  177.   SF-STRING     _"Text"               "gimp.org"
  178.   SF-FONT       _"Font"               "Sans"
  179.   SF-ADJUSTMENT _"Font size (pixels)" '(24 2 1000 1 10 0 1)
  180.   SF-COLOR      _"Text color"         '(135 220 220)
  181.   SF-COLOR      _"Highlight color"    '(210 240 245)
  182.   SF-COLOR      _"Dark color"         '(46 74 92)
  183.   SF-COLOR      _"Shadow color"       "black"
  184.   SF-TOGGLE     _"Autocrop"           TRUE
  185.   SF-TOGGLE     _"Remove background"  TRUE
  186.   SF-TOGGLE     _"Index image"        TRUE
  187.   SF-ADJUSTMENT _"Number of colors"   '(15 2 255 1 10 0 1)
  188.   SF-ADJUSTMENT _"Select-by-color threshold" '(1 1 256 1 10 0 1)
  189. )
  190.  
  191. (script-fu-menu-register "script-fu-small-header-gimp-org"
  192.                          "<Image>/File/Create/Web Page Themes/Classic.Gimp.Org")
  193.